<template>
	<view>
		<u-popup :show="show" :round="10" @close="close">
			<view class="popupTitle">
				<u-icon name="close" color='#fff'></u-icon>
				<view>
					选择摄像头
				</view>
				<u-icon name="close" @click="close"></u-icon>
			</view>
			<scroll-view class="popupBody" scroll-y="true">
				<view class="BodyBox">
					<view class="bodyItem" v-for="(item,index) in devices" :key="item" @click="jump(item)">
						<view class="bodyHeader">
							<view class="icon-shexiangtou iconfont font40"></view>
							<view style="flex: 1;margin: 0 5rpx;">
								<u-text lines='1' :text='item.name' size='24rpx' />
							</view>
							<view class="icon-guanji- iconfont font40 " :class="{blue:item.status}"></view>
						</view>
						<view class="bodyHeader">
							<u-text lines='1' :text='item.pivot.area?item.pivot.area:"暂无位置信息"' size='24rpx' />
							<text style="color: #bbb;margin-left: 10rpx;">{{item.status?'开机':'关机'}}</text>
						</view>
					</view>
				</view>
			</scroll-view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		props: ['show','devices'],
		data() {
			return {
				loading: true,
			}
		},
		watch: {},
		methods: {
			close() {
				this.$emit('close')
			},
			jump(item){
				this.$utils.navigateTo({
					url:'/customer/live?code='+item.serial_number
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.BodyBox {
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		align-items: flex-start;
	}

	.popupBody {
		width: 100vw;
		box-sizing: border-box;
	}

	.bodyHeader {
		display: flex;
		justify-content: space-between;
		align-items: center;	}

	.bodyItem {
		padding: 40rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		flex-direction: column;
		width: 49%;
		border-radius: 8rpx;
		background-color: #eee;
		height: 200rpx;
		margin-bottom: 20rpx;
	}

	.font40 {
		font-size: 40rpx;
	}

	.icon-guanji- {
		color: #bbb;
	}

	.blue {
		color: #3975c6;
	}
</style>